package eerbaar.v2.graphics.rect;

import java.awt.Point;
import java.awt.Rectangle;

public class RectCenter {

    public static Point calcTopLeft(Rectangle current, int width, int height) {

        final int top = current.y;
        final int left = current.x;
        final int cHeight = current.height;

        int verticalSpace = cHeight - height;
        verticalSpace = verticalSpace / 2;

        int horizontolSpace = cHeight - width;
        horizontolSpace = horizontolSpace / 2;

        int x = left + horizontolSpace;
        int y = top + verticalSpace;
        return new Point(x, y);
    }

}
